#ifndef CONTEXTMENU_H
#define CONTEXTMENU_H

#include <QMenu>

/*! \class ContextMenu
    \brief Sets the contextual menu of files in the file browser
    BrowserButtons class is used for configuring the contextual menu of files in the file browse. By default some basic actions
    are added (like open, copy, cut, paste...) but is also possible to add custom actions and remove the predefined ones
*/
class ContextMenu : public QMenu
{
    Q_OBJECT
public:
    //! Class constructor
    /*!
      This function adds default actions to the context menu
      */
    explicit ContextMenu(QWidget *parent = 0);

    //! Adds an action to the conext menu
    /*!
      Adds a custom action to the conext menu of files in the file browser
      \param action Action to be added to the context menu
      */
    void addContextMenuAction(QAction *action);

    //! Adds a menu to the conext menu
    /*!
      Adds a custom menu to the conext menu of files in the file browser
      \param menu Menu to be added to the context menu
      */
    void addContextMenuMenu(QMenu *menu);

    //! Adds a separator to the conext menu
    /*!
      Adds a separator to the conext menu of files in the file browser
      */
    void addContextMenuSeparator();

    //! Removes an action from the conext menu
    /*!
      Removes an action from the conext menu of files in the file browser
      \param action Action to be removed from the context menu
      */
    void removeFromContextMenu(QAction *action);

    //! Returns context menu's list of actions
    /*!
      Returns a list with the context menu actions
      */
    QList <QAction *> contextMenuActions();

    //! Enables/disables New Folder option in the context menu
    /*!
      Enables/disables New Folder option in the context menu. Normally is enabled when the selected file (current index of the data model) is a directory
      */
    void setNewFolderEnabled(bool);
    //! Enables/disables Paste option in the context menu
    /*!
      Enables/disables Paste option in the context menu. Normally is enabled when there is something in the clipboard
      and disabled after pasting the content
      */
    void setPasteEnabled(bool);
    //! Enables/disables Delete option in the context menu
    /*!
      Enables/disables Delete option in the context menu.
      */
    void setDeleteEnabled(bool);
    //! Enables/disables Rename option in the context menu
    /*!
      Enables/disables Rename option in the context menu.
      */
    void setRenameEnabled(bool);
    //! Enables/disables Open option in the context menu
    /*!
      Enables/disables Open option in the context menu.
      */
    void setOpenEnabled(bool);

private:
    //! New menu within the context menu. Includes actions like cretion of folders
    QMenu *fbNewMenu;
    //! Action for opening a file or directory
    QAction *open;
    //! Action for deleting a file or directory
    QAction *del;
    //! Action for copying a file or directory
    QAction *copy;
    //! Action for cutting a file or directory
    QAction *cut;
    //! Action for pasting a file or directory
    QAction *paste;
    //! Action for renaming a file or directory
    QAction *rename;
    //! Action for creating a directory
    QAction *addFolder;

signals:
    //! This signal is emitted when the open menu option is triggered
    void openTriggered();
    //! This signal is emitted when the copy menu option is triggered
    void copyTriggered();
    //! This signal is emitted when the cut menu option is triggered
    void cutTriggered();
    //! This signal is emitted when the paste menu option is triggered
    void pasteTriggered();
    //! This signal is emitted when the delete menu option is triggered
    void deleteTriggered();
    //! This signal is emitted when the rename menu option is triggered
    void renameTriggered();
    //! This signal is emitted when the New Folder menu option is triggered
    void createFolderTriggered();

public slots:

};

#endif // CONTEXTMENU_H
